/***************************************************************************//**
 * @file MSc_Angles.h
 * @author  Marek M. Cel <marekcel@mscsim.org>
 *
 * @section LICENSE
 *
 * Copyright (C) 2013 Marek M. Cel
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 ******************************************************************************/
#ifndef MSC_ANGLES_H
#define MSC_ANGLES_H

////////////////////////////////////////////////////////////////////////////////

#include <string>

#include "MSc_Utils.h"

////////////////////////////////////////////////////////////////////////////////

/** Bryant angles class. */
class MSc_Angles
{
public:

    /** Constructor. */
    MSc_Angles();

    /** Copy constructor. */
    MSc_Angles( const MSc_Angles &angl );

    /** Returns angles constructed from given values. */
    static MSc_Angles getFrom( double phi, double tht, double psi );

    /** @return 1 if all items are valid */
    bool isValid() const;

    inline double   phi() const { return m_phi; }
    inline double   tht() const { return m_tht; }
    inline double   psi() const { return m_psi; }
    inline double & phi()       { return m_phi; }
    inline double & tht()       { return m_tht; }
    inline double & psi()       { return m_psi; }

    /** Sets angles values. */
    void set( double phi, double tht, double psi );

    /** This function returns string represtation of the angles. */
    std::string toString();

    /** Assignment operator. */
    MSc_Angles& operator= ( const MSc_Angles &angl );

    /** Equality operator. */
    bool operator== ( const MSc_Angles &angl ) const;

    /** Inequality operator. */
    bool operator!= ( const MSc_Angles &angl ) const;

private:

    double m_phi;   ///< [rad] angle of rotation about x-axis
    double m_tht;   ///< [rad] angle of rotation about y-axis
    double m_psi;   ///< [rad] angle of rotation about z-axis

};

////////////////////////////////////////////////////////////////////////////////

#endif // MSC_ANGLES_H
